package top.dingwen.io.treasure.api.upc;

import lombok.extern.slf4j.Slf4j;
import top.dingwen.io.treasure.api.base.constant.ApiConstant;

/**
 * 当前用户实现 </br>
 * <ul>
 *     <li>若使用着没有从新实现该接口则以默认实现为准,否则以使用者实现的接口为准</li>
 *     <li>此接口不应该多实现,默认+自定义即可</li>
 * </ul>
 *
 * @author dingwen
 * @since 2023/3/19 16:57
 */
@Slf4j
@SuppressWarnings(ApiConstant.ALL)
public class DefaultCurrentUserServiceImpl implements ICurrentUserService {
    @Override
    public Long getTenantId() {
        log.warn("{},{},[getTenantId()]获取当前登录租户编号默认实现生效,默认返回默认租户编号:{}",
                ApiConstant.API_LOG_P_S,
                ApiConstant.API_LOG_P_CUS,
                ApiConstant.D_T_ID
        );
        return ApiConstant.D_T_ID;
    }

    @Override
    public String getAccount() {
        log.warn("{},{},[getAccount()]获取当前登录账号默认实现生效,默认返回默认:{}",
                ApiConstant.API_LOG_P_S,
                ApiConstant.API_LOG_P_CUS,
                ApiConstant.D_ACCOUNT
        );
        return ApiConstant.D_ACCOUNT;
    }

    @Override
    public String getClientCode() {
        log.warn("{},{},[getClientCode()]获取当前登录租户编码默认实现生效,默认返回默认编码:{}",
                ApiConstant.API_LOG_P_S,
                ApiConstant.API_LOG_P_CUS,
                ApiConstant.D_C_CODE
        );
        return ApiConstant.D_C_CODE;
    }

    @Override
    public String getTenantDataSourceKey() {
        log.warn("{},{},[getTenantDataSourceKey()]获取当前登录租户数据源默认实现生效,默认返回默认名称:{}",
                ApiConstant.API_LOG_P_S,
                ApiConstant.API_LOG_P_CUS,
                ApiConstant.D_T_DS_NAME
        );
        return ApiConstant.D_T_DS_NAME;
    }

    @Override
    public String getLoginName() {
        log.warn("{},{},[getLoginName()]获取当前登录名称默认实现生效,默认返回匿名名称:{}",
                ApiConstant.API_LOG_P_S,
                ApiConstant.API_LOG_P_CUS,
                ApiConstant.ANONYMOUS_LOGIN_NAME
        );
        return ApiConstant.ANONYMOUS_LOGIN_NAME;
    }

    @Override
    public <T> T getLoginId() {
        log.warn("{},{},[getLoginId()]获取当前登录编号默认实现生效,默认返回:{}",
                ApiConstant.API_LOG_P_S,
                ApiConstant.API_LOG_P_CUS,
                ApiConstant.ANONYMOUS_LOGIN_ID
        );
        return (T) ApiConstant.ANONYMOUS_LOGIN_ID;
    }

    @Override
    public <T> T getCurrentUser() {
        log.warn("{},{},[getCurrentUser()]获取当前登录用户默认实现生效,默认返回:null",
                ApiConstant.API_LOG_P_S,
                ApiConstant.API_LOG_P_CUS
        );
        return null;
    }

    @Override
    public ScopeContainerResponse getCurrentScope() {
        log.info("{},{},获取当前范围信息执行",
                ApiConstant.API_LOG_P_S,
                ApiConstant.API_LOG_P_CUS
        );
        return new ScopeContainerResponse();
    }
}
